/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package dungeonsolver.helper;

import dungeonsolver.controller.algorithm.AlgorithmAStar;
import dungeonsolver.controller.algorithm.AlgorithmBFS;
import dungeonsolver.controller.algorithm.AlgorithmDFS;
import dungeonsolver.controller.algorithm.AlgorithmGreedy;
import dungeonsolver.controller.algorithm.AlgorithmUCS;
import dungeonsolver.controller.algorithm.IAlgorithm;

/**
 *
 * @author user
 */
public final class AlgorithmFactory {
	private AlgorithmFactory() {}

	public static IAlgorithm createAlgorithm(String algorithm) {
		//Based on string
		if (algorithm.equals(IAlgorithm.AlgorithmType.DFS.toString()))			return new AlgorithmDFS();
		else if (algorithm.equals(IAlgorithm.AlgorithmType.BFS.toString()))		return new AlgorithmBFS();
		else if (algorithm.equals(IAlgorithm.AlgorithmType.GREEDY.toString()))	return new AlgorithmGreedy();
		else if (algorithm.equals(IAlgorithm.AlgorithmType.ASTAR.toString()))	return new AlgorithmAStar();
        else if (algorithm.equals(IAlgorithm.AlgorithmType.UCS.toString()))		return new AlgorithmUCS();
		else																	return null;
	}

}
